/**
 * Created by lx on 2017/9/25.
 */
angular.module('module.table.group', [
        'ngStorage',
        'service.tablegroup'
    ])
    .config(['$stateProvider', function ($stateProvider) {
        $stateProvider

            .state('grouplist', {
                url: '/grouplist?tableid',
                resolve: {
                    groupList: ['$q', 'TableGroupService', '$localStorage', function ($q, TableGroupService, $localStorage) {
                        var shopid = $localStorage[environmental + "shopid"];
                        var deferred = $q.defer();
                        TableGroupService.getGroupByShopId(shopid, function (sucData) {
                            deferred.resolve(sucData);
                        }, function (error) {
                            deferred.resolve("undefined");
                        });
                        return deferred.promise;
                    }]
                },
                templateUrl: table_view_url + 'group/list.html',
                controller: 'GroupListController',
                controllerAs: 'vm',
            })
            .state('groupadd', {
                url: '/groupadd?tableid',
                templateUrl: table_view_url + 'group/add.html',
                controller: 'GroupAddController',
                controllerAs: 'vm',
            })
    }])